using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace EuropeEngulfed.NET
{
    partial class RegionSelectionDialog : Form
    {
        private MapInfo.RegionID selectedRegion = MapInfo.RegionID.Albania;

        public MapInfo.RegionID SelectedRegion
        {
            get
            {
                return selectedRegion;
            }
        }

        public RegionSelectionDialog(List<MapInfo.RegionID> listOfRegions, string title)
        {
            InitializeComponent();
            this.titleLabel.Text = title;
            foreach (MapInfo.RegionID region in listOfRegions)
            {
                this.regionsComboBox.Items.Add(region.ToString());
            }
            this.regionsComboBox.SelectedItem = this.regionsComboBox.Items[0];
        }

        private void regionsComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedRegion = (MapInfo.RegionID)Enum.Parse(typeof(MapInfo.RegionID), this.regionsComboBox.SelectedItem.ToString());
        }

        private void OkButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}